<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>BIBLIO: /home/marco/workspace/biblio/src/worker.c File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">BIBLIO
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">/home/marco/workspace/biblio/src/worker.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Implementazione del thread worker del bibserver.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;errno.h&gt;</code><br/>
<code>#include &lt;fcntl.h&gt;</code><br/>
<code>#include &lt;limits.h&gt;</code><br/>
<code>#include &lt;pthread.h&gt;</code><br/>
<code>#include &lt;signal.h&gt;</code><br/>
<code>#include &lt;stdio.h&gt;</code><br/>
<code>#include &lt;string.h&gt;</code><br/>
<code>#include &lt;time.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="bib_8h_source.html">bib.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="biblio_8h_source.html">biblio.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="comsock_8h_source.html">comsock.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="worker_8h_source.html">worker.h</a>&quot;</code><br/>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afd700ebe8cdee4f667ef2312531cb029"></a><!-- doxytag: member="worker.c::worker_start" ref="afd700ebe8cdee4f667ef2312531cb029" args="(void *sfd)" -->
void *&#160;</td><td class="memItemRight" valign="bottom"><b>worker_start</b> (void *sfd)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3d82f5cfa55ea55e809cafee9a8c1ec5"></a><!-- doxytag: member="worker.c::worker_signal_handling" ref="a3d82f5cfa55ea55e809cafee9a8c1ec5" args="(void)" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>worker_signal_handling</b> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a64f580d9e1d0e761c0e38e2a99996b3d"></a><!-- doxytag: member="worker.c::search" ref="a64f580d9e1d0e761c0e38e2a99996b3d" args="(scheda_t **books[], char **values, char type)" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>search</b> (<a class="el" href="bib_8h.html#a20e8400f11091455ae779864b085d5cd">scheda_t</a> **books[], char **values, char type)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#a5d8e444c648c6741f6639d3b8db0bf87">book_match</a> (char *values[], <a class="el" href="bib_8h.html#a20e8400f11091455ae779864b085d5cd">scheda_t</a> *book)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#a1a52066dd4cd954d0d04f7ccdcb3872d">lookup</a> (char *string)</td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">FILE *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#ab25a3625a8efbaa3d81ef27bbb51c9c5">logfile</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#ab18693215565ea1a797096dfe19e895f">records</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct tm *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#a17c48460db08d68bf4193816c7f8bb7d">loan_end</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#a143cf4916e069eed8183e88ae3d3a937">lookup_table</a> []</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="bib_8h.html#a20e8400f11091455ae779864b085d5cd">scheda_t</a> **&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#a679e2c9d4e63b4a587a4e5974ceb63e8">biblio</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">pthread_mutex_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#aa16a39555f8535b9b4415f27438d84f0">biblio_mtx</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">pthread_mutex_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#ae4a93cc82852a2f213b19f75bfe77220">workers_mtx</a></td></tr>
<tr><td colspan="2"><div class="groupHeader">Variabili globali ma locali al thread</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">__thread int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#ac0781212d1b3ce609824009bbfc0b4a2">client_connection</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">__thread sigset_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="worker_8c.html#a937c9fac5f0b009d28b553cad5011601">set</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Implementazione del thread worker del bibserver. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Marco Luisi Si dichiara che il contenuto di questo file e' in ogni sua parte opera originale dell' autore. </dd></dl>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a5d8e444c648c6741f6639d3b8db0bf87"></a><!-- doxytag: member="worker.c::book_match" ref="a5d8e444c648c6741f6639d3b8db0bf87" args="(char *values[], scheda_t *book)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="worker_8h.html#a5d8e444c648c6741f6639d3b8db0bf87">book_match</a> </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>values</em>[], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="bib_8h.html#a20e8400f11091455ae779864b085d5cd">scheda_t</a> *&#160;</td>
          <td class="paramname"><em>book</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">values</td><td></td></tr>
    <tr><td class="paramname">book</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd></dd></dl>

<p>References <a class="el" href="structpubblicazione.html#a99e5b4dc1ea28b771a3a252874350f68">pubblicazione::anno</a>, <a class="el" href="structscheda.html#ac607cadabc9b74ca4f4e9a6fd7ae126f">scheda::autore</a>, <a class="el" href="structautore.html#a36c8a5f6fb6fb0bcbfeb048b6ace7598">autore::cognome</a>, <a class="el" href="structscheda.html#a4d52097908ce95230d2086c645a7995d">scheda::collocazione</a>, <a class="el" href="structscheda.html#af67064d05c9029300f5fb41878da199e">scheda::descrizione_fisica</a>, <a class="el" href="structpubblicazione.html#a36b67891a21606252b5755e7d3dc64b3">pubblicazione::editore</a>, <a class="el" href="structpubblicazione.html#a2c03564c60296c70361739f300573edd">pubblicazione::luogo</a>, <a class="el" href="bib_8h.html#a94a9355898094a43596f429ebd6c6313">NCAMPI</a>, <a class="el" href="structautore.html#a1ef38b1313b340ae6472862d08ab6682">autore::next</a>, <a class="el" href="structautore.html#a462d9b6df287f19833696f3b50384b9b">autore::nome</a>, <a class="el" href="structscheda.html#a88969ed00efdfa463967b2be64e8431b">scheda::nota</a>, <a class="el" href="structscheda.html#a75c191e014448496afb0f1dcd690e279">scheda::pub</a>, and <a class="el" href="structscheda.html#a724319bee26af032b620dd2f6e0c9a0b">scheda::titolo</a>.</p>

</div>
</div>
<a class="anchor" id="a1a52066dd4cd954d0d04f7ccdcb3872d"></a><!-- doxytag: member="worker.c::lookup" ref="a1a52066dd4cd954d0d04f7ccdcb3872d" args="(char *string)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="worker_8h.html#a1a52066dd4cd954d0d04f7ccdcb3872d">lookup</a> </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>string</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Funzione di riconoscimento dei campi per la ricerca. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">string</td><td>parametro da controllare </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>codice corrispondente o codice d'errore </dd></dl>

<p>References <a class="el" href="bibserver_8c.html#a143cf4916e069eed8183e88ae3d3a937">lookup_table</a>, and <a class="el" href="bib_8h.html#a94a9355898094a43596f429ebd6c6313">NCAMPI</a>.</p>

</div>
</div>
<hr/><h2>Variable Documentation</h2>
<a class="anchor" id="a679e2c9d4e63b4a587a4e5974ceb63e8"></a><!-- doxytag: member="worker.c::biblio" ref="a679e2c9d4e63b4a587a4e5974ceb63e8" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="bib_8h.html#a20e8400f11091455ae779864b085d5cd">scheda_t</a>** <a class="el" href="worker_8c.html#a679e2c9d4e63b4a587a4e5974ceb63e8">biblio</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Array per le schede bibliografiche </p>

</div>
</div>
<a class="anchor" id="aa16a39555f8535b9b4415f27438d84f0"></a><!-- doxytag: member="worker.c::biblio_mtx" ref="aa16a39555f8535b9b4415f27438d84f0" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">pthread_mutex_t <a class="el" href="worker_8c.html#aa16a39555f8535b9b4415f27438d84f0">biblio_mtx</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Mutex per la biblioteca </p>

</div>
</div>
<a class="anchor" id="ac0781212d1b3ce609824009bbfc0b4a2"></a><!-- doxytag: member="worker.c::client_connection" ref="ac0781212d1b3ce609824009bbfc0b4a2" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">__thread int <a class="el" href="worker_8c.html#ac0781212d1b3ce609824009bbfc0b4a2">client_connection</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>aa </p>

<p>Referenced by <a class="el" href="bibserver_8h.html#a4d04cb98d237318ce61bc06c2689ab52">serve()</a>.</p>

</div>
</div>
<a class="anchor" id="a17c48460db08d68bf4193816c7f8bb7d"></a><!-- doxytag: member="worker.c::loan_end" ref="a17c48460db08d68bf4193816c7f8bb7d" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct tm* <a class="el" href="worker_8c.html#a17c48460db08d68bf4193816c7f8bb7d">loan_end</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Data di fine prestito </p>

<p>Referenced by <a class="el" href="bibserver_8h.html#a20fc82d55de724cea43db877925aff49">init()</a>.</p>

</div>
</div>
<a class="anchor" id="ab25a3625a8efbaa3d81ef27bbb51c9c5"></a><!-- doxytag: member="worker.c::logfile" ref="ab25a3625a8efbaa3d81ef27bbb51c9c5" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">FILE* <a class="el" href="worker_8c.html#ab25a3625a8efbaa3d81ef27bbb51c9c5">logfile</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>File di log </p>

<p>Referenced by <a class="el" href="bibserver_8h.html#a20fc82d55de724cea43db877925aff49">init()</a>, and <a class="el" href="bibserver_8h.html#a84e414317c5f9ca3e549c1c419f2acc4">save()</a>.</p>

</div>
</div>
<a class="anchor" id="a143cf4916e069eed8183e88ae3d3a937"></a><!-- doxytag: member="worker.c::lookup_table" ref="a143cf4916e069eed8183e88ae3d3a937" args="[]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char* <a class="el" href="worker_8c.html#a143cf4916e069eed8183e88ae3d3a937">lookup_table</a>[]</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Tabella di lookup comune agli workers </p>

<p>Referenced by <a class="el" href="worker_8h.html#a1a52066dd4cd954d0d04f7ccdcb3872d">lookup()</a>.</p>

</div>
</div>
<a class="anchor" id="ab18693215565ea1a797096dfe19e895f"></a><!-- doxytag: member="worker.c::records" ref="ab18693215565ea1a797096dfe19e895f" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="worker_8c.html#ab18693215565ea1a797096dfe19e895f">records</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Numero di libri della biblioteca </p>

<p>Referenced by <a class="el" href="bibserver_8h.html#a20fc82d55de724cea43db877925aff49">init()</a>, <a class="el" href="bib_8h.html#aeb2bac0603823ee1f0e22b8f43728b1e">load_records()</a>, <a class="el" href="bibserver_8h.html#a84e414317c5f9ca3e549c1c419f2acc4">save()</a>, and <a class="el" href="bib_8h.html#ab3eb1b5de833e2fff25a542111a76ad0">store_records()</a>.</p>

</div>
</div>
<a class="anchor" id="a937c9fac5f0b009d28b553cad5011601"></a><!-- doxytag: member="worker.c::set" ref="a937c9fac5f0b009d28b553cad5011601" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">__thread sigset_t <a class="el" href="worker_8c.html#a937c9fac5f0b009d28b553cad5011601">set</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>b </p>

</div>
</div>
<a class="anchor" id="ae4a93cc82852a2f213b19f75bfe77220"></a><!-- doxytag: member="worker.c::workers_mtx" ref="ae4a93cc82852a2f213b19f75bfe77220" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">pthread_mutex_t <a class="el" href="worker_8c.html#ae4a93cc82852a2f213b19f75bfe77220">workers_mtx</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Mutex per la gestione degli workers </p>

<p>Referenced by <a class="el" href="bibserver_8h.html#a4d04cb98d237318ce61bc06c2689ab52">serve()</a>.</p>

</div>
</div>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Fri Jun 29 2012 10:36:44 for BIBLIO by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
